package com.aaa.dao;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;


public interface F_TiXiDao {
    @Select("<script>select a.id,a.name ,b.name yearname  from testproject a LEFT JOIN year b on a.yearid=b.id  " +
            " where 1=1 <if test=\"year!=null and year!=0\"> and b.name= #{year}</if>  " +
            "limit #{start},#{pageSize} </script>")
    List<Map> selectList(Map map);
    @Select("<script>select count(a.id) from testproject a LEFT JOIN year b on a.yearid=b.id " +
            " where 1=1 <if test=\"year!=null and year!=0\"> and b.name= #{year}</if>  " +
            "  </script>")
    Integer getCount(Map map);
    @Select("select id yid,name yearname from year")
    List<Map> getYear();
    @Update("update testproject set name=#{name},yearid=#{yearid} where id=#{id}")
    int update(Map map);
@Insert("insert into testproject(name,yearid) VALUES(#{name},#{yearid})")
    int add(Map map);
@Delete("DELETE FROM testproject where id=#{id}")
    int del(Integer id);
    @Select("select id tname from year where name=#{yearname}")
    int getid(Map map);
@Select("select content from testcontent where pid=#{id}")
    List<Map> getConter(Integer id);
}
